ZerosLike ================= 将输出数组逐元素置为 0。 该算子不依赖输入数据,仅根据给定长度与数据类型,对输出缓冲区进行清零操作,常用于初始化张量或中间结果。 .. math:: dst_i = 0 输入: - **length** - 计算长度。 - **core_mask** - 核掩码(仅适用于共享存储版本)。 输出: - **output** - 输出数据地址,逐元素被置为 0。 支持平台: ``FT78NE`` ``MT7004`` .. note:: - FT78NE 支持 fp, dp, int8, int16, int32, cplx64, cplx128 - MT7004 支持 hp, fp, int16, int32, cplx64 - 复数类型中实部与虚部均被置为 0 **共享存储版本:** .. c:function:: void i8_zerolike_s(int8_t* output, int length, int core_mask) .. c:function:: void i16_zerolike_s(int16_t* output, int length, int core_mask) .. c:function:: void i32_zerolike_s(int32_t* output, int length, int core_mask) .. c:function:: void hp_zerolike_s(half* output, int length, int core_mask) .. c:function:: void fp_zerolike_s(float* output, int length, int core_mask) .. c:function:: void dp_zerolike_s(double* output, int length, int core_mask) .. c:function:: void c64_zerolike_s(float* output, int length, int core_mask) .. c:function:: void c128_zerolike_s(double* output, int length, int core_mask) **C调用示例:** .. code-block:: c :linenos: :emphasize-lines: 10 //FT78NE示例 #include #include int main(int argc, char* argv[]) { float *output = (float *)0xA0000000; // output在DDR空间 int length = 1024; int core_mask = 0xff; fp_zerolike_s(output, length, core_mask); return 0; } **私有存储版本:** .. c:function:: void i8_zerolike_p(int8_t* output, int length) .. c:function:: void i16_zerolike_p(int16_t* output, int length) .. c:function:: void i32_zerolike_p(int32_t* output, int length) .. c:function:: void hp_zerolike_p(half* output, int length) .. c:function:: void fp_zerolike_p(float* output, int length) .. c:function:: void dp_zerolike_p(double* output, int length) .. c:function:: void c64_zerolike_p(float* output, int length) .. c:function:: void c128_zerolike_p(double* output, int length) **C调用示例:** .. code-block:: c :linenos: :emphasize-lines: 9 //FT78NE示例 #include #include int main(int argc, char* argv[]) { float *output = (float *)0x10810000; // output在L2空间 int length = 1024; fp_zerolike_p(output, length); return 0; }